//
//  XPPXcodeC4UMenuItem.m
//  XPPXcodePlugin
//
//  Created by yoyokko on 10-4-22.
//  Copyright 2010 yoyokko@gmail.com. All rights reserved.
//

#import "XPPXcodePlugin.h"
#import "XPPXcodeMenuItem.h"
#import <Sparkle/Sparkle.h>

// Handles the about GTM Xcode Plugin menu item in the Application menu.
@interface XPPXcodeC4UMenuItem : XPPXcodeMenuItem
@end

@implementation XPPXcodeC4UMenuItem
+ (void)load {
	NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
	[XPPXcodePlugin registerMenuItem:[[[self alloc] init] autorelease]];
	[pool drain];
}

- (NSString*)title {
	return @"Check For XPP Updates";
}

- (void)action:(id)sender {
	SUUpdater *updater = [SUUpdater updaterForBundle:[XPPXcodePlugin pluginBundle]];
	[updater checkForUpdates:self];
}

- (NSMenu*)insertionMenu {
	NSMenu *rootMenu = [NSApp mainMenu];
	NSMenuItem *appleMenuItem = [rootMenu itemAtIndex:0];
	return [appleMenuItem submenu];
}

- (int)insertionIndex {
	return 2;
}
@end
